import 'package:connectivity_plus/connectivity_plus.dart';

class NetStatusMonitor {
  // 检查当前网络状态
  static Future<List<ConnectivityResult>> getCurrentStatus() async {
    return await Connectivity().checkConnectivity();
  }

  // 监听网络状态变化
  static Stream<List<ConnectivityResult>> get wifiStateStream {
    return Connectivity().onConnectivityChanged;
  }

  // 检查WiFi是否连接
  static Future<bool> isWifiConnected() async {
    final result = await getCurrentStatus();
    return result == ConnectivityResult.wifi;
  }
}
